import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/text_title_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/text_title_entity.g.dart';

@JsonSerializable()
class TextTitleEntity extends ContentData {
  @JSONField(name: "title_size")
  String? titleSize = '';
  @JSONField(name: "desc_weight")
  String? descWeight = '';
  String? link = '';
  String? title = '';
  String? align = '';
  String? uuid = '';
  @JSONField(name: "link_id")
  int? linkId = 0;
  @JSONField(name: "wx_author")
  String? wxAuthor = '';
  @JSONField(name: "link_method")
  String? linkMethod = '';
  @JSONField(name: "desc_color")
  String? descColor = '';
  @JSONField(name: "template_type")
  String? templateType = '';
  @JSONField(name: "link_style")
  String? linkStyle = '';
  @JSONField(name: "title_color")
  String? titleColor = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  @JSONField(name: "show_divider")
  String? showDivider = '';
  @JSONField(name: "desc_size")
  String? descSize = '';
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "bg_color")
  String? bgColor = '';
  int? pageMargin = 0;
  @JSONField(name: "wx_link_title")
  String? wxLinkTitle = '';
  @JSONField(name: "title_weight")
  String? titleWeight = '';
  @JSONField(name: "is_link")
  String? isLink = '';
  @JSONField(name: "wx_date")
  String? wxDate = '';
  @JSONField(name: "link_text")
  String? linkText = '';
  String? desc = '';

  TextTitleEntity() {
    type = 'title_text'; // 直接在构造函数中赋值
  }

  factory TextTitleEntity.fromJson(Map<String, dynamic> json) => $TextTitleEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $TextTitleEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return TextTitleEntity.fromJson(json);
  }
}
